package com.ll.gulimall.member.web;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.ll.common.utils.R;
import com.ll.gulimall.member.feign.feign.OrderFeignService;
import com.ll.gulimall.member.vo.OrderEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

@Controller
public class MeberWebController {


    @Autowired
    OrderFeignService orderFeignService;

    /**
     * 获取用户订单数据
     *
     * @param model
     * @return
     */
    @GetMapping("/memberOrder.html")
    public String memberOrderPage(Model model, @RequestParam(defaultValue = "1", value = "pageNum") Integer pageNum) {
        Map<String, Object> params = new HashMap<>();
        params.put("page", pageNum.toString());
        R r = orderFeignService.getOrderByMember(params);
        model.addAttribute("orders", r);
        return "memberOrder";
    }
}
